home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / List.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-19  |  2.4 KB  |  104 lines

  1. /* Interface for Objective-C NeXT-compatible List object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This library is free software; you can redistribute it and/or
  8.    modify it under the terms of the GNU Library General Public
  9.    License as published by the Free Software Foundation; either
  10.    version 2 of the License, or (at your option) any later version.
  11.    
  12.    This library is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.    Library General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU Library General Public
  18.    License along with this library; if not, write to the Free
  19.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */ 
  21.  
  22. #ifndef __List_h_INCLUDE_GNU
  23. #define __List_h_INCLUDE_GNU
  24.  
  25. #include <objc/Object.h>
  26.  
  27. @interface List : Object
  28. {
  29.   @public
  30.   id         *dataPtr;    /* data of the List object */
  31.   unsigned     numElements;    /* Actual number of elements */
  32.   unsigned     maxElements;    /* Total allocated elements */
  33. }
  34.  
  35. /* Creating, copying, freeing */
  36.  
  37. - free;
  38. - freeObjects;
  39. - shallowCopy;
  40. - deepen;
  41.   
  42. /* Initializing */
  43.  
  44. - init;
  45. - initCount:(unsigned)numSlots;
  46.  
  47. /* Comparing two lists */
  48.  
  49. - (BOOL)isEqual: anObject;
  50.   
  51. /* Managing the storage capacity */
  52.  
  53. - (unsigned)capacity;
  54. - setAvailableCapacity:(unsigned)numSlots;
  55.  
  56. /* Manipulating objects by index */
  57.  
  58. - (unsigned)count;
  59. - objectAt:(unsigned)index;
  60. - lastObject;
  61. - addObject:anObject;
  62. - insertObject:anObject at:(unsigned)index;
  63. - removeObjectAt:(unsigned)index;
  64. - removeLastObject;
  65. - replaceObjectAt:(unsigned)index with:newObject;
  66. - appendList: (List *)otherList;
  67.  
  68. /* Manipulating objects by id */
  69.  
  70. - (unsigned)indexOf:anObject;
  71. - addObjectIfAbsent:anObject;
  72. - removeObject:anObject;
  73. - replaceObject:anObject with:newObject;
  74.  
  75. /* Emptying the list */
  76.  
  77. - empty;
  78.  
  79. /* Archiving */
  80.  
  81. - read: (TypedStream*)aStream;
  82. - write: (TypedStream*)aStream;
  83.  
  84. /* Sending messages to elements of the list */
  85.  
  86. - makeObjectsPerform:(SEL)aSel;
  87. - makeObjectsPerform:(SEL)aSel with:anObject;
  88.  
  89. /* old-style creation */
  90.  
  91. + newCount:(unsigned)numSlots;
  92.  
  93. @end
  94.  
  95. typedef struct {
  96.     @defs(List)
  97. } NXListId;
  98.  
  99. #define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr)
  100.  
  101. #define NX_NOT_IN_LIST    0xffffffff
  102.  
  103. #endif /* __List_h_INCLUDE_GNU */
  104.